#include<iostream>
using namespace std;
int pell(int n)
{
	if(n<=1) return n;
	else return 2*pell(n-1)+pell(n-2);
	
} 
int main(){
	int n,a;
	cin>>n;	
	while(cin>>a)
    {
        cout<<pell(a)<<endl;
    }
	
	return 0;
}
